package com.example.hzq.zqb.activity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;

import com.example.hzq.zqb.R;
import com.example.hzq.zqb.bean.EnterpriseBean;

/**
 * Created by hzq on 2017/7/12.
 */

public class EnterprisedetailActivity extends AppCompatActivity implements View.OnClickListener {
    private Button call;
    private ImageButton back;
    private EnterpriseBean enterpriseBean;
    private TextView top,workname,salary,address,time,type,num,sex,whos,date,worktime,work,people,addressdatail,owner,tel;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.enterprisedetail);
        back=(ImageButton)findViewById(R.id.back1);
        call=(Button)findViewById(R.id.e_detail_call);
        top=(TextView)findViewById(R.id.toptext);
        workname=(TextView)findViewById(R.id.e_detail_workname);
        salary=(TextView)findViewById(R.id.e_detail_salary);
        address=(TextView)findViewById(R.id.e_detail_address);
        time=(TextView)findViewById(R.id.e_detail_time);
        type=(TextView)findViewById(R.id.e_detail_worktype);
        num=(TextView)findViewById(R.id.e_detail_neednum);
        sex=(TextView)findViewById(R.id.e_detail_needsex);
        whos=(TextView)findViewById(R.id.e_detail_whosenter);
        date=(TextView)findViewById(R.id.e_detail_workdata);
        worktime=(TextView)findViewById(R.id.e_detail_worktime);
        work=(TextView)findViewById(R.id.e_detail_work);
        people=(TextView)findViewById(R.id.e_detail_people);
        addressdatail=(TextView)findViewById(R.id.e_detail_addressdetail);
        owner=(TextView)findViewById(R.id.e_detail_owner);
        tel=(TextView)findViewById(R.id.e_detail_tel);
        enterpriseBean=(EnterpriseBean)getIntent().getSerializableExtra("enterprise");
        top.setText("职位信息");
        workname.setText(enterpriseBean.getPosition());
        salary.setText(enterpriseBean.getSalary());
        address.setText(enterpriseBean.getAddress());
        time.setText(enterpriseBean.getCreatetime());
        type.setText(enterpriseBean.getType());
        num.setText(enterpriseBean.getNumber());
        sex.setText(enterpriseBean.getSex());
       whos.setText(enterpriseBean.getAgency());
        date.setText(enterpriseBean.getWork_date());
        worktime.setText(enterpriseBean.getWork_per());
        work.setText(enterpriseBean.getContent());
        people.setText(enterpriseBean.getFinish_number());
        addressdatail.setText(enterpriseBean.getDetail_address());
        owner.setText(enterpriseBean.getContacts());
       tel.setText(enterpriseBean.getPhone());
        call.setOnClickListener(this);
        back.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.back1:
                finish();
                break;
            case R.id.e_detail_call:
                startActivity(new Intent(Intent.ACTION_DIAL, Uri.fromParts("tel", tel.getText().toString(), null)));
                break;
        }
    }
}
